package com.xc.freeapp.service.impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.xc.freeapp.dao.FreeRegPhoneMapper;
import com.xc.freeapp.dao.dataSource.DBContextHolder;
import com.xc.freeapp.entity.FreeRegPhone;
import com.xc.freeapp.service.FreeregphoneService;

@Service
public class FreeregphoneServiceImpl implements FreeregphoneService {
  
	@Autowired
	private  FreeRegPhoneMapper  freeregphonedao;
	
	public int deleteByPrimaryKey(Integer id) {
		DBContextHolder.switchDataSourceRW();//切换数据源
		return freeregphonedao.deleteByPrimaryKey(id);
	}

	public int insert(FreeRegPhone record) {
		DBContextHolder.switchDataSourceRW();//切换数据源
		return freeregphonedao.insertSelective(record);
	}

	public FreeRegPhone selectByPrimaryKey(Integer id) {
		DBContextHolder.switchDataSourceRW();//切换数据源
		return freeregphonedao.selectByPrimaryKey(id);
	}
	
	public List<FreeRegPhone> selectByuserid(Integer userid){
		DBContextHolder.switchDataSourceRW();//切换数据源
		return freeregphonedao.selectByuserid(userid);
	}

}
